'Public Class SepPanel
'    Inherits PictureBox

'    Private Sub SepPanel_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
'        e.Graphics.DrawLine(New Pen(Color.FromArgb(64, Color.Black)), 0, 0, Width, 0)
'        e.Graphics.DrawLine(New Pen(Color.FromArgb(64, Color.White)), 0, 1, Width, 1)
'    End Sub

'    Sub New()
'        BackColor = Color.Transparent
'    End Sub

'End Class

Public Class PictureButton
    Inherits PictureBox

    Dim State As ButtonState
    Dim HasFocus As Boolean

    Shadows Event Paint(ByVal sender As Object, ByVal e As PictureButtonPaintEventArgs)

    Protected Overrides Sub OnPaint(ByVal pevent As System.Windows.Forms.PaintEventArgs)
        Dim Args As New PictureButtonPaintEventArgs
        Args.Graphics = pevent.Graphics
        Args.State = State
        Args.HasFocus = HasFocus
        RaiseEvent Paint(Me, Args)
    End Sub

    Class PictureButtonPaintEventArgs
        Public Graphics As Graphics
        Public State As ButtonState
        Public HasFocus As Boolean
    End Class

    Enum ButtonState
        MouseLeave
        MouseEnter
        MouseDown
    End Enum

    Private Sub PictureButton_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Enter
        HasFocus = True
        Invalidate()
    End Sub

    Private Sub PictureButton_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
        HasFocus = False
        Invalidate()
    End Sub

    Private Sub PictureButton_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        State = ButtonState.MouseDown
        Invalidate()
    End Sub

    Private Sub PictureButton_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter
        State = ButtonState.MouseEnter
        Invalidate()
    End Sub

    Private Sub PictureButton_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave
        State = ButtonState.MouseLeave
        Invalidate()
    End Sub

    Private Sub PictureButton_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
        State = ButtonState.MouseEnter
        Invalidate()
    End Sub

End Class

Public Class PictureBox
    Inherits System.Windows.Forms.PictureBox

    Sub New()
        DoubleBuffered = True
        ResizeRedraw = True
    End Sub

End Class

Public Class Panel
    Inherits System.Windows.Forms.Panel

    Sub New()
        DoubleBuffered = True
        ResizeRedraw = True
    End Sub

End Class
